// Copyright (c) Appeon. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

namespace SnapObjects.Data
{
    /// <summary>
    ///     Represents an object which can be used to create the condition on which the join is based in the JOIN clause.
    /// </summary>
    public interface ISqlJoinOnBuilder : ISqlJoinOnAndOr
    {
        /// <summary>
        ///     Creates an ON clause and adds a search condition to it. Specifies the SQL expression on the left of the 
        ///     operator and a specific value on the right of the operator. The operator is '='.
        /// </summary>
        /// <param name="left">An expression on the left of the operator.</param>
        /// <param name="value">The specific value on the right of the operator.</param>
        /// <returns>
        ///     Returns the ISqlJoinOnAndOr object which can be used to add more search conditions to the current ON clause.
        /// </returns>
        ISqlJoinOnAndOr OnValue(string left, object value);

        /// <summary>
        ///     Creates an ON clause and adds a search condition to it. Specifies a SQL expression on the left of the 
        ///     operator and a specific value on the right of the operator.
        /// </summary>
        /// <param name="left">An expression on the left of the operator.</param>
        /// <param name="sqlOperator">
        ///     An enumeration value of SqlBinaryOperator, which is the operator to test the expressions on the left and the value on the right.
        /// </param>
        /// <param name="value">The specific value on the right of the operator.</param>
        /// <returns>
        ///     Returns the ISqlJoinOnAndOr object which can be used to add more search conditions to the current ON clause.
        /// </returns>
        ISqlJoinOnAndOr OnValue(string left, SqlBinaryOperator sqlOperator, object value);

        /// <summary>
        ///     Creates an ON clause and adds a search condition to it. Specifies SQL expressions on both the left and
        ///     right of the operator. The operator is '='.
        /// </summary>
        /// <param name="left">A SQL expression on the left of the operator.</param>
        /// <param name="right">A SQL expression on the right of the operator.</param>
        /// <returns>
        ///     Returns the ISqlJoinOnAndOr object which can be used to add more search conditions to the current ON clause.
        /// </returns>
        ISqlJoinOnAndOr On(string left, string right);

        /// <summary>
        ///     Creates an ON clause and adds a search condition to it. Specifies SQL expressions on both the left and
        ///     right of the operator.
        /// </summary>
        /// <param name="left">A SQL expression on the left of the operator.</param>
        /// <param name="sqlOperator">
        ///     An enumeration value of SqlBinaryOperator, which is the operator to test the two expressions on the left and right.
        /// </param>
        /// <param name="right">A SQL expression on the right of the operator.</param>
        /// <returns></returns>
        ISqlJoinOnAndOr On(string left, SqlBinaryOperator sqlOperator, string right);

        /// <summary>
        ///     Creates an ON clause and adds a search condition to it. Specifies a SQL expression on the left of the 
        ///     operator and a SQL parameter on the right of the operator. The operator is '='.
        /// </summary>
        /// <param name="left">A SQL expression on the left of the operator.</param>
        /// <param name="parameter">
        ///     An ISqlParameter object which represents a SQL parameter.
        ///     It can be created by calling the SqlBuilder.Parameter method.
        /// </param>
        /// <returns>
        ///     Returns the ISqlJoinOnAndOr object which can be used to add more search conditions to the current ON clause.
        /// </returns>
        ISqlJoinOnAndOr On(string left, ISqlParameter parameter);

        /// <summary>
        ///     Creates an ON clause and adds a search condition to it. Specifies a SQL expression on the left of the 
        ///     operator and a SQL parameter on the right of the operator.
        /// </summary>
        /// <param name="left">A SQL expression on the left of the operator.</param>
        /// <param name="sqlOperator">
        ///     An enumeration value of SqlBinaryOperator, which is the operator to test the two expressions on the left and right.
        /// </param>
        /// <param name="parameter">
        ///     An ISqlParameter object which represents a SQL parameter.
        ///     It can be created by calling the SqlBuilder.Parameter method.
        /// </param>
        /// <returns>
        ///     Returns the ISqlJoinOnAndOr object which can be used to add more search conditions to the current ON clause.
        /// </returns>
        ISqlJoinOnAndOr On(string left, SqlBinaryOperator sqlOperator, ISqlParameter parameter);

        /// <summary>
        ///     Creates an ON clause and adds a search condition to it. Specifies the SQL expression on the left of the operator and
        ///     the SQL subquery on the right. The operator is '='.
        /// </summary>
        /// <param name="left">A SQL expression on the left of the operator.</param>
        /// <param name="sqlBuilder">
        ///     An ISqlBuilder object which represents a SQL subquery on the right of the operator.
        /// </param>
        /// <returns>
        ///     Returns the ISqlJoinOnAndOr object which can be used to add more search conditions to the current ON clause.
        /// </returns>
        ISqlJoinOnAndOr On(string left, ISqlBuilder sqlBuilder);

        /// <summary>
        ///     Creates an ON clause and adds a search condition to it. Specifies a SQL expression on the left of the operator 
        ///     and a SQL subquery on the right.
        /// </summary>
        /// <param name="left">A SQL expression on the left of the operator.</param>
        /// <param name="sqlOperator">
        ///     An enumeration value of SqlBinaryOperator, which is the operator to test the two expressions on the left and right.
        /// </param>
        /// <param name="sqlBuilder">
        ///     An ISqlBuilder object which represents a SQL subquery on the right of the operator.
        /// </param>
        /// <returns>
        ///     Returns the ISqlJoinOnAndOr object which can be used to add more search conditions to the current ON clause.
        /// </returns>
        ISqlJoinOnAndOr On(string left, SqlBinaryOperator sqlOperator, ISqlBuilder sqlBuilder);

        /// <summary>
        ///     Creates an ON clause and adds a search condition to it using an ISqlJoinCondition object.
        /// </summary>
        /// <param name="condition">
        ///     An ISqlJoinCondition which represents a search condition in the ON Clause.
        ///     This object can be created by using the SqlBuilder.On method and so on.
        /// </param>
        /// <returns>
        ///     Returns the ISqlJoinOnAndOr object which can be used to add more search conditions to the current ON clause.
        /// </returns>
        ISqlJoinOnAndOr On(ISqlJoinCondition condition);

        /// <summary>
        ///     Creates an ON clause and adds a raw SQL to it.
        /// </summary>
        /// <param name="clause">A string of raw SQL to be added to the ON clause.</param>
        /// <param name="parameters">
        ///     (Optional) An array of ISqlParameter objects which define the SQL parameters used in the raw SQL.
        /// </param>
        /// <returns>
        ///     Returns the ISqlJoinOnAndOr object which can be used to add more search conditions to the current ON clause.
        /// </returns>
        ISqlJoinOnAndOr OnRaw(string clause, params ISqlParameter[] parameters);
    }
}
